//
//  QDQRTypeSelectedViewCell.swift
//  QDMetroClient
//
//  Created by YueWen on 2019/2/22.
//  Copyright © 2019 YueWen. All rights reserved.
//

import UIKit

/// 二维码类型选择cell
final class QDQRTypeSelectedViewCell: NWTableViewCell {

    /// 选择状态的视图
    let selectedImageView = UIImageView()
    /// 选择方式的描述
    let titleLabel = UILabel()
    
    override func buildView() {
        super.buildView()
        
        titleLabel.textColor = QDColors.separator
        titleLabel.font = Font.regular.font(size: 16)
        
        contentView.addSubview(titleLabel)
        contentView.addSubview(selectedImageView)
        
        bottomLineInset.left = 20
        bottomLineInset.right = 20
        bottomLineHeight = 0.5
        bottomLineView.backgroundColor = #colorLiteral(red: 0.9294117647, green: 0.9411764706, blue: 0.9333333333, alpha: 1)
        
        titleLabel.snp.makeConstraints { (make) in
            make.left.equalToSuperview().offset(20)
            make.centerY.equalToSuperview().offset(0.5)
            make.height.equalTo(22)
        }
        
        selectedImageView.snp.makeConstraints { (make) in
            make.centerY.equalTo(titleLabel)
            make.width.height.equalTo(24)
            make.right.equalToSuperview().inset(20)
        }
    }
    
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
//        selectedImageView.backgroundColor = selected ? QDColors.theme : QDColors.gray
        selectedImageView.image = selected ? "cs_select".namedImage : "cs_deselect".namedImage
    }
}
